﻿using System;
using NJabber.Stream.Elements;

namespace NJabber.Client
{
    public class StanzaEventArgs<T> : EventArgs where T : Stanza
    {
        private T stanza;

        public StanzaEventArgs(T stanza)
        {
            if (stanza == null) throw new ArgumentNullException("stanza");
            this.stanza = stanza;
        }

        public T Stanza
        {
            get { return stanza; }
        }

        public override bool Equals(object obj)
        {
            return Stanza.Equals(obj);
        }
    }

    public class StanzaReceivedEventArgs : StanzaEventArgs<Stanza>
    {
        public StanzaReceivedEventArgs(Stanza stanza) : base(stanza)
        {
        }
    }

    public class IqReceivedEventArgs : StanzaEventArgs<IqStanza>
    {
        public IqReceivedEventArgs(IqStanza iqStanza) : base(iqStanza)
        {
        }
    }

    public class MessageReceivedEventArgs : StanzaEventArgs<MessageStanza>
    {
        public MessageReceivedEventArgs(MessageStanza messageStanza) : base(messageStanza)
        {
        }
    }

    public class PresenceReceivedEventArgs : StanzaEventArgs<PresenceStanza>
    {
        public PresenceReceivedEventArgs(PresenceStanza presenceStanza) : base(presenceStanza)
        {
        }
    }
}
